<%--
  @author Kusal Samarakoon
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<script type="text/javascript">

    $(function () {
        $( "#billDate" ).datepicker();
        $( "#checkDate" ).datepicker();
        $( "#mOrderDate" ).datepicker();


        var paymentCashHtml = $('#paymentCash').html();
        var paymentChequeHtml = $('#paymentCheque').html();
        var paymentMoneyOrderHtml = $('#paymentMoneyOrder').html();

        $('#paymentType2').bind('click', function () {
            $('#paymentCash').html(' ');
            $('#paymentCheque').html(' ');
            $('#paymentMoneyOrder').html(paymentMoneyOrderHtml);
        });

        $('#paymentType0').bind('click', function () {
            $('#paymentCash').html(paymentCashHtml);
            $('#paymentCheque').html(' ');
            $('#paymentMoneyOrder').html(' ');
        });

        $('#paymentType1').bind('click', function () {
            $('#paymentCash').html(' ');
            $('#paymentCheque').html(paymentChequeHtml);
            $('#paymentMoneyOrder').html(' ');
        });

        if ($('#paymentType2').is(':checked')) {
            $('#paymentCash').html(' ');
            $('#paymentCheque').html(' ');
            $('#paymentMoneyOrder').html(paymentMoneyOrderHtml);
        } else if ($('#paymentType0').is(':checked')) {
            $('#paymentCash').html(paymentCashHtml);
            $('#paymentCheque').html(' ');
            $('#paymentMoneyOrder').html(' ');
        } else if ($('#paymentType1').is(':checked')) {
            $('#paymentCash').html(' ');
            $('#paymentCheque').html(paymentChequeHtml);
            $('#paymentMoneyOrder').html(' ');
        }
    });
</script>

<div id="land-registration-module-home-title" class="module-home-title">
    <s:a href="paymentModule.do">
        <span><img src="${pageContext.request.contextPath}/images/payment.png" alt="Land Registration">
            <s:label value="%{getText('land_payments_module.label')}"/></span>
    </s:a>
    <span class="module-title-breaker"> > </span>
    <s:a href="detailForm.do">
        <span><img src="${pageContext.request.contextPath}/images/monthly-rent.png" alt="Enter Detailed Land Information">
            <s:label value="Annual Rent"/></span>
    </s:a>
    <div id="back-button" align="right">
        <s:form><s:submit value="%{getText('back_btn.label')}" action="landRegistrationModule"/></s:form>
    </div>
</div>
<div id="detail-land-update-list">
    <div class="page-title">
        <h2><s:label value="Paid Payment Invoice Detail"/></h2>
    </div>
    <s:if test="hasActionErrors() || hasActionMessages()">
        <div id="message-box" class="message-box">
            <div class="action-msg"><s:actionmessage/></div>
            <div class="action-err"><s:actionerror/></div>
        </div>
    </s:if>

<s:form method="POST" id="payment-form" name="payment-form" enctype="multipart/form-data">

    <div id="pay-slip">
        <div id="personal-details">
            <table>
                <tr>
                    <td>File Number : </td>
                    <td colspan="3"><s:label  value="%{alienation.land.landFileNumber}"/></td>
                </tr>

                <tr>
                    <td>Lease Number : </td>
                    <td colspan="3"><s:label value="%{alienation.leaseDetail.leaseNo}" /></td>
                </tr>


            </table>

            <table class="width-100">
                <tr>
                    <td align="center" colspan="4">
                        <s:radio id="paymentType" name="payment.paymentType"
                                 list="#@java.util.HashMap@{'2':'Money Order', '1':'Cheque','0':'Cash'}"
                                 value="%{payment.paymentType}" disabled="true"/>
                    </td>
                </tr>
            </table>
            <table id="paymentCash" class="width-100">
                <tr>
                    <td>Bill No</td><td><s:label value="%{payment.receiptReferenceNo}"/></td>
                    <td>Billing Date</td><td><s:label value="%{payment.billingDate}"/></td>
                </tr>
                <tr>
                    <td colspan="4">Payment Info :</td>
                </tr>
                <tr>
                    <td>Rental (Rs:)</td><td><s:label value="%{payment.rentalAmount}"/></td>
                    <td>Tax (Rs:)</td><td><s:label value="%{payment.taxAmount}"/></td>
                </tr>


            </table>
                <table id="paymentCheque" class="width-100">
                    <tr>
                        <td>Cheque No</td><td><s:label value="%{payment.receiptReferenceNo}"/></td>
                        <td>Cheque Date</td><td><s:label value="%{payment.billingDate}"/></td>
                    </tr>
                    <tr>
                        <td colspan="4">Payment Info :</td>
                    </tr>
                    <tr>
                        <td>Rental (Rs:)</td><td><s:label value="%{payment.rentalAmount}"/></td>
                        <td>Tax (Rs:)</td><td><s:label value="%{payment.taxAmount}"/></td>
                    </tr>

                </table>
                <table id="paymentMoneyOrder" class="width-100">
                    <tr>
                        <td>Money Order No</td><td><s:label value="%{payment.receiptReferenceNo}"/></td>
                        <td>Money Order Date</td><td><s:label value="%{payment.billingDate}"/></td>
                    </tr>
                    <tr>
                        <td colspan="4">Payment Info :</td>
                    </tr>
                    <tr>
                        <td>Rental (Rs:)</td><td><td><s:label value="%{payment.rentalAmount}"/></td>
                        <td>Tax (Rs:)</td><td><td><s:label value="%{payment.taxAmount}"/></td>
                    </tr>


                </table>

            <table>
                <tr>
                    <td>Total Rental (Rs:)</td>
                    <td colspan="3"><s:label id="totalPayable" value="%{alienation.leaseDetail.totalPayable}"/></td>
                </tr>

                <tr>
                    <td>Arrears Rental (Rs:)</td>
                    <td colspan="3"><s:label id="arrearsAmount" value="%{alienation.leaseDetail.arrearsAmount}" /></td>
                </tr>

                <tr>
                    <td>Arrears Tax (Rs:)</td>
                    <td colspan="3"><s:label id="arrearsTax" value="%{alienation.leaseDetail.arrearsTax}" /></td>
                </tr>

                <tr>
                    <td>Paid Rental (Rs:)</td>
                    <td colspan="3"><s:label  value="%{alienation.leaseDetail.paidAmount}" /></td>
                </tr>

                <tr>
                    <td>Paid Tax (Rs:)</td>
                    <td colspan="3"><s:label value="%{alienation.leaseDetail.paidTax}" /></td>
                </tr>
            </table>
            <s:submit cssClass="cancel" action="home" value="Close"/>
            <s:if test="payment.paymentState.ordinal() == 0">
                <s:submit cssClass="cancel" action="confirmPayment" value="Confirm Payment"/>
            </s:if>

           <%-- <s:submit cssClass="cancel" action="" value="Print Voucher"/>--%>
        </div>
    </div>
    <s:hidden name="payment.id"/>
    </s:form>
</div>


